/*
 * Copyright (c) 2018-2023 北京华恒盛世科技有限公司
 * QUICKPOOL is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *     http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
*/

#include "quickpool.h"
#include "subcmd/subcmd.h"

int
js_restart_handler(int argc, char **argv) {
    return cmd_admin_control(argc, argv, ADMIN_JSRESTART);
}

int
js_hist_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_JSHIST);
}

int
js_debug_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_JSDEBUG);
}

int
js_time_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_JSTIME);
}

int
jm_stop_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_NODE_SHUTDOWN);
}

int
jm_restart_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_JMRESTART);
}

int
jm_debug_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_JMDEBUG);
}

int
jm_time_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_JMTIME);
}

int
node_open_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_NODE_OPEN);
}

int
node_close_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_NODE_CLOSE);
}
    
int
node_hist_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_HHIST);
}

int
node_group_handler(int argc, char **argv)
{
    argv[0] = (char *)"hostgroup";
    return cmd_list_groups(argc, argv);
}

int
queue_open_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_QUEUE_OPEN);
}

int
queue_close_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_QUEUE_CLOSE);
}

int
queue_active_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_QUEUE_ACT);
}

int
queue_inact_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_QUEUE_INACT);
}

int
queue_hist_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_QHIST);
}

int
queue_nodeadd_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_QUEUE_NODEADD);
}

int
queue_noderemove_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_QUEUE_NODEREMOVE);
}

int
queue_nodeupdate_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_QUEUE_NODEUPDATE);
}

int
user_group_handler(int argc, char **argv)
{
    argv[0] = (char *)"usergroup";
    return cmd_list_groups(argc, argv);
}

int
js_checkconf_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_CKCONFIG);
}

int
js_reconfig_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_RECONFIG);
}

int
jm_checkconf_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_JM_CKCONFIG);
}

int
jm_reconfig_handler(int argc, char **argv)
{
    return cmd_admin_control(argc, argv, ADMIN_JM_RECONFIG);
}

